# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'libkate'
    version = '0.4.1'
    stype = SourceType.TARBALL
    url = 'xiph://kate/libkate-%(version)s.tar.gz'
    tarball_checksum = 'c40e81d5866c3d4bf744e76ce0068d8f388f0e25f7e258ce0c8e76d7adc87b68'
    licenses = [{License.BSD_like: ['COPYING']}]
    deps = ['libogg', 'libpng']
    patches = ['libkate/0002-build-skip-tools-tests-and-doc-subdirs.patch']

    files_libs = ['libkate', 'liboggkate']
    files_devel = ['include/kate', 'lib/pkgconfig/kate.pc', 'lib/pkgconfig/oggkate.pc']

    def prepare(self):
        # Tell internal script to call python3 instead of python on non-Windows
        # platforms since Python 3 is still python.exe on Windows.
        if self.config.platform != Platform.WINDOWS:
            self.append_env('PYTHON', 'python3')
        if self.config.target_distro == Distro.ARCH:
            self.append_env('LDFLAGS', '-Wl,-O1,--sort-common,--as-needed,-z,relro')
        if self.config.platform != Platform.WINDOWS:
            self.autoreconf = True
            self.patches += ['libkate/0001-be-more-permissive-with-automake-errors-now-that-we-.patch']
        self.append_env('CFLAGS', '-Wno-error')
